# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.coffee.
# You can use CoffeeScript in this file: http://coffeescript.org/
window.UserView = Backbone.View.extend
  el: "body"
  events:
    "click a.button-follow-user": "followUser"

  initialize: (opts) ->
    @parentView = opts.parentView


#  followUser: (e) ->
#    btn = $(e.currentTarget)
#    userId = btn.data("id")
#    span = btn.find("span")
#    if btn.hasClass("active")
#      $.ajax
#        url: "/users/#{userId}/unfollow"
#        type: "POST"
#        success: (res) ->
#          if res.code == 0
#            btn.removeClass('active')
#            span.text("关注")
#    else
#      $.ajax
#        url: "/users/#{userId}/follow"
#        type: 'POST'
#        success: (res) ->
#          if res.code == 0
#            btn.addClass('active').attr("title", "")
#            span.text("取消关注")
#    return false